%% getAxisManually
%
% Prompts user to input axis information manually
%
%% Synatax
%
% [ 772, 80 ] = getAxisManually( dicomImg )
%
% [ 780, 100 ] = getAxisManually( dicomImg )
%
%% Description
%
% This function prompts the user to view a clinical image (a dicom for
% example) and enter the y axis velocity information (the position of a
% labeled hashmark and the corresponding value). Acceptable values are
% between 10 and 200.
%
%% Arguments
%* dicomImg                          - Double: An image containing heart
%                                              rate information
%
%% Returns
%
%* axisHashYPosition                 - Double: The y coordinate (row
%                                              number) of the user
%                                              seleected hash mark
%
%* axisLabel                         - Double: The value correlating to the
%                                              user entered hash mark
%
%% Function Side Effects
%
%* A figure is displayed
%
%* The user is prompted to enter a heart rate in the console
%
%% Exceptions
%
% * N/A
%
%% See Also
% getAxisScale

function [ axisHashYPosition, axisLabel ] = getAxisManuallyGUI( dicomImg, inputAxes, instructionText )

set(instructionText, 'string', strcat('Failed to detect y-axis scale programmatically.', ...
    ' please click on any hash mark corresponding to labeled y-axis value'));

axes(inputAxes)
imshow(dicomImg)
hold on


axisHashYPosition = getrect();

axisHashYPosition = axisHashYPosition(2);

set(instructionText, 'string', 'Please enter corresponding y-axis value.');
axisLabel = str2double(cell2mat(inputdlg(strcat('Please enter corresponding axis value: '), ...
    'Enter Heart Rate.',[1 40],{'120'},'on')));


% Possible velocity values
possibleVals = 10:200;

% Verifies user is entering a legitimate value
while isempty(axisLabel) || isnumeric(axisLabel) == 0 || isempty(find(abs(axisLabel) == possibleVals)) 
    
    imshow(dicomImg);
    
    set(instructionText, 'string', 'Please enter corresponding y-axis value.');
    axisLabel = str2double(cell2mat(inputdlg(strcat('Please enter corresponding axis value: '), ...
    'Enter Heart Rate.',[1 40],{'60'},'on')));
    
    
end

% Corrects for user entering in negative value as depicted on dicom
axisLabel = abs(axisLabel);


end

